package com.design.observer;

import java.util.Observable;
import java.util.Observer;

import com.design.event.FireEvent;

/**
 * @Author: BuYee
 * @Date: 2022/8/24
 */
public class BaoAnObserver implements Observer {

    private String name;

    private Integer location;

    public BaoAnObserver(String name, Integer location) {
        this.name = name;
        this.location = location;
    }

    @Override
    public void update(Observable o, Object arg) {
        FireEvent event = (FireEvent) arg;
        if (event.getLocation() == this.location) {
            System.out.println(location + "层着火啦！" + name + "去救火");
        }
    }
}
